#include "dlgaddintroduction.h"
#include "ui_dlgaddintroduction.h"

#include <QMessageBox>

DlgAddIntroduction::DlgAddIntroduction(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::DlgAddIntroduction)
{
    ui->setupUi(this);
    //使每次弹窗都在最前面
    setWindowFlag(Qt::WindowStaysOnTopHint);
}

DlgAddIntroduction::~DlgAddIntroduction()
{
    delete ui;
}

void DlgAddIntroduction::showIntro(QString strIntro)
{
    ui->textEditIntro->setText(strIntro);
}

void DlgAddIntroduction::on_ptnAddIntro_clicked()
{
    QString intro = ui->textEditIntro->toPlainText();
    if (intro.isEmpty())
    {
        QMessageBox::critical(this,"错误",QString("添加简介为空"));
        return;
    }
    emit sendIntroData(intro);
}

void DlgAddIntroduction::on_ptnClearIntro_clicked()
{
    ui->textEditIntro->clear();
    emit sendIntroData("");
}
